//---------------------------------------------------------------------------
#ifndef DMD_MainH
#define DMD_MainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>

#include <dir.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <Menus.hpp>
#include <Dialogs.hpp>

#define _free(x) if ( x ){ free(x); x = NULL; }

//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
 TMainMenu *MainMenu1;
 TMenuItem *File1;
 TMenuItem *OpenROMfile1;
 TMenuItem *N1;
 TMenuItem *Exit1;
 TMenuItem *SaveROMfile1;
 TMenuItem *Program1;
 TMenuItem *Decompress1;
 TMenuItem *N647CD;
 TMenuItem *RecompresswCOMPfile1;
 TOpenDialog *FOpen;
 TMenuItem *N649D71;
 TMenuItem *N64B2E1;
 TMenuItem *N650DF1;
 TMenuItem *N6570D1;
 TListBox *ListBox1;
 TMenuItem *N2;
 TMenuItem *N65B4C1;
 void __fastcall RecompresswCOMPfile1Click(TObject *Sender);
 
 void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
 
 void __fastcall N647CDClick(TObject *Sender);
 void __fastcall FormCreate(TObject *Sender);
 void __fastcall SaveROMfile1Click(TObject *Sender);
 void __fastcall OpenROMfile1Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
 __fastcall TForm1(TComponent* Owner);

  int  __fastcall Decomp( LONG lpStart, LONG lpSize );
  int  __fastcall Recomp( LONG lpStart, LONG lpEnd, LONG lpSize );
  LONG __fastcall FileSize( FILE *tf );

  LONG lpStart,
       lpEnd,
       lpSize,
       ROMSize;

  char cur_dir[MAXPATH];
  char dirc[MAXPATH];  
  char fil1[MAXPATH];
  char fil2[MAXPATH];
  char fil3[MAXPATH];
  char buffer[MAXPATH];

  BYTE *ram;
  BYTE *rom;
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
